package dto;

public class ColumnDTO {
	private String name;
	private String dataType;
	private int colIndex;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public ColumnDTO(String name, String dataType) {
		super();
		this.name = name;
		this.dataType = dataType;
	}

	public ColumnDTO(String name, String dataType, int colIndex) {
		super();
		this.name = name;
		this.dataType = dataType;
		this.colIndex = colIndex;
	}


	@Override
	public boolean equals(Object obj) {
		if (obj != null) {
			return this.name.equalsIgnoreCase(((ColumnDTO)obj).getName());
		}
		return false;
	}

	@Override
	public String toString() {
		return "Name : " + name + ", DataType : " + dataType;
	}

	/**
	 * Cast to ColumnIconDTO
	 * 
	 * @return
	 */
	public ColumnIconDTO castToColumnIconDTO() {
		return new ColumnIconDTO(this.name, this.dataType);
	}
}
